package com.neusoft.elm.controller;

import com.neusoft.elm.po.Orders;
import com.neusoft.elm.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/OrdersController")
public class OrdersController {
    @Autowired
    private OrdersService ordersService;
    @RequestMapping("/createOrders")
    public Object createOrders(String userId,Integer businessId,Integer daId) throws Exception {
        int orders = ordersService.createOrders(userId, businessId, daId);
        return orders;

    }
    @RequestMapping("/getOrdersById")
        public Object getOrdersById (Integer orderId) throws Exception{
        Orders orders = ordersService.getOrdersById(orderId);
        return orders;

    }
    @RequestMapping("/listOrdersByUserId")
    public Object listOrdersByUserId(String userId) throws Exception{
        List<Orders> orders = ordersService.listOrdersByUserId(userId);
        return orders;
    }
}


